package com.crazyhat.crazyhat.entity;

import java.io.Serializable;
import java.time.LocalDateTime;

import org.hibernate.validator.constraints.URL;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.crazyhat.crazyhat.anno.ClubCategoryAnno;
import com.crazyhat.crazyhat.attribute.ClubStatusEnum;
import com.crazyhat.crazyhat.attribute.PostPublicScopeEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;

import jakarta.validation.constraints.NotEmpty;
import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 * 社团
 * </p>
 *
 * @author crazyhat
 * @since 2024-07-05
 */
@Getter
@Setter
@TableName("club")
public class Club implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 社团ID
     */
    @TableId(value = "club_id", type = IdType.AUTO)
    private Integer clubId;

    /**
     * 社团名称
     */
    @NotEmpty
    @TableField("club_name")
    private String clubName;

    /**
     * 社团简介
     */
    @TableField("club_description")
    private String clubDescription;

    /**
     * logo地址
     */
    @URL
    @TableField("logo_url")
    private String logoUrl;

    /**
     * 负责人ID
     */
    @TableField("leader_id")
    private Integer leaderId;

    /**
     * 负责人姓名
     */
    @TableField("leader_name")
    private String leaderName;

    /**
     * 发布时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("publish_time")
    private LocalDateTime publishTime;

    /**
     * 社团类别
     */
    @ClubCategoryAnno
    @TableField("category")
    private String category;

    /**
     * 现有人数
     */
    @TableField("current_members")
    private Integer currentMembers;

    /**
     * 加入要求
     */
    @TableField("requirements")
    private String requirements;

    /**
     * 动态公开范围
     */
    @TableField("post_public_scope")
    private PostPublicScopeEnum postPublicScope;

    /**
     * 社团状态
     */
    @TableField("club_status")
    private ClubStatusEnum clubStatus;

    /**
     * 热度
     */
    @JsonIgnore
    @TableField("popularity")
    private Integer popularity;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("update_time")
    private LocalDateTime updateTime;

    /**
     * 二把手名单
     */
    @JsonIgnore
    @TableField("second_manager")
    private String secondManager;
}
